﻿using System;
using Rio.Workflow.Runtime;
using Rio.Workflow.Runtime.Enums;
using NetBay.Core.Log;

namespace Rio.Workflow.Invoicing
{
    public class InvoicingAction : WorkflowActionContext
    {

        /// <summary>
        /// Executes the reject action.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public override ActionResult ActionExecuted(WorkflowContextBase context, ActionRequest request)
        {
            ActionResult result = ActionResult.Faulted;
            try
            {
                result = ActionResult.Executed;
            }
            catch (Exception ex)
            {
                LogManager.Instance().LogDebugFormat("Execute error - " + ex.Message);
                throw;
            }

            return result;
        }

        /// <summary>
        /// Executes the reject action.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public override ActionResult ActionExecutedAll(WorkflowContextBase context, ActionRequest request)
        {
            ActionResult result = ActionResult.Faulted;
            try
            {
                result = ActionResult.Executed;
            }
            catch (Exception ex)
            {
                LogManager.Instance().LogDebugFormat("ExecuteAll error - " + ex.Message);
                throw;
            }

            return result;
        }

        /// <summary>
        /// Actions the executing.
        /// </summary>
        /// <param name="wkfContext">The WKF context.</param>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public override ActionResult ActionExecuting(WorkflowContextBase wkfContext, ActionRequest request)
        {
            return ActionResult.NotSupported;
        }

        /// <summary>
        /// Actions the executing all.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public override ActionResult ActionExecutingAll(WorkflowContextBase context, ActionRequest request)
        {
            return ActionResult.NotSupported;
        }


    }
}
